<ui:composition xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:p="http://primefaces.org/ui"
        template="template.xhtml">
    <ui:define name="content">
        <div class="content ui-widget ui-widget-content ui-corner-all">
	        <h2>Releases</h2>
	        <h:form>
	            <h:panelGrid columns="2">
	                <h:outputText value="Project:" />                
		            <p:selectOneMenu value="#{releaseBean.productName}" onchange="submit()" effectDuration="1" styleClass="selectOneMenu">
	                    <f:selectItem itemLabel="--Select--" itemValue="" />
		                <f:selectItems value="#{productBean.products}" />
		            </p:selectOneMenu>
	            </h:panelGrid>
	            <br />
	            <p:dataTable value="#{releaseBean.releases}" var="release" rendered="#{not empty releaseBean.releases}" style="width: 100%">
	                <p:column style="width: 100px">
	                    <f:facet name="header">Name</f:facet>
	                    <h:commandLink value="#{release.name}" action="#{releaseBean.edit}">
	                        <f:setPropertyActionListener target="#{releaseBean.release}" value="${release}" />
	                    </h:commandLink>
	                </p:column>
                    <p:column style="width: 100px">
                        <f:facet name="header">Date</f:facet>
                        <h:outputText value="#{release.date}">
                            <f:convertDateTime type="date" pattern="dd-MMM-yyyy" timeZone="#{dateBean.timeZone}" />
                        </h:outputText>
                    </p:column>
                    <p:column>
                        <f:facet name="header">Description</f:facet>
                        <h:outputText value="#{release.description}" />
                    </p:column>
	            </p:dataTable>
                <h:panelGroup rendered="#{not empty releaseBean.productName and empty releaseBean.releases}">
                    <p>No releases defined.</p>
                </h:panelGroup>
                <br />
	            <p:commandButton value="Add Release" action="#{releaseBean.add}" ajax="false" rendered="#{not empty releaseBean.productName}" />
		    </h:form>
        </div>
    </ui:define>
</ui:composition>
